<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/11/19 0019
 * Time: 22:33
 */

class Image_model extends MY_Model{

    //配置端
    public function __construct(){
        parent::__construct();
        //连接数据库
//        $this->setTableName('u_m_articles');
//        $this->categoryTable = $this->db->dbprefix('u_c_articles_category');
    }

    /**
     * 查找表内的内容
     * $what 查什么 id title content
     * $where 条件 id=1 category=2
     * $order 排序
     * */
    public function select($what='*',$where='1=1',$order='1=1',$limit=null){
        $this->db=$this->load->database("default",TRUE);
        $sql = '';
        if($limit){
            $sql = "SELECT {$what} FROM u_m_images WHERE {$where} ORDER BY {$order} LIMIT {$limit}";
        }else{
            $sql = "SELECT {$what} FROM u_m_images WHERE {$where} ORDER BY {$order}";
        }
        $array = $this->db->query($sql)->result_array();
        return $array;
    }
}